package com.example.bookcar.mapper;

import com.example.bookcar.dto.QueryCarDTO;
import com.example.bookcar.entity.Car;
import com.example.bookcar.vo.CarBrandorTypeVO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 18225
* @description 针对表【t_car(车辆表)】的数据库操作Mapper
* @createDate 2023-03-01 16:27:42
* @Entity com.example.bookcar.pojo.Car
*/
@Mapper
public interface CarMapper {
    //查询所有车辆信息
    List<Car> listAll();

    //分页查询车辆信息
    Page<Car> listPage();

    //分页查询car信息
    Page<Car> listSearch(@Param("queryCarDTO") QueryCarDTO queryCarDTO);

    //根据id查询car信息
    Car getCarInfoById(Integer id);

    //更新car信息
    int updateCarInfo(@Param("car") Car car);

    //删除车辆信息
    int deleteInfoById(Integer id);

    //添加车辆信息
    int addCarIfno(Car car);

    List<CarBrandorTypeVO> listCarTypes();

    @Select("select count(*) from t_car where status = 1")
    int allPredictCount();

    @Select("select * from t_car where is_show = 1 and status = 1")
    List<Car> listAllPredictCar();

    @Select("select price from t_car where is_show = 1 and id = #{carId}")
    Long getCarDayRentPrice(Long carId);
}




